//  default {
export function dataFormat(originVal){
    const date = new Date(originVal)
    const year = date.getFullYear()
    const month = (date.getMonth() + 1 + '').padStart(2,'0')
    const day = (date.getDate() + '').padStart(2,'0')
    const hh = (date.getHours() + '').padStart(2,'0')
    const mm = (date.getMinutes() + '').padStart(2,'0')
    const ss = (date.getSeconds() + '').padStart(2,'0')
    // return `${year}-${month}-${day}`
    return `${year}-${month}-${day} ${hh}:${mm}:${ss}`
  }

export function SimpleDataFormat(originVal){
  const date = new Date(originVal)
  const year = date.getFullYear()
  const month = (date.getMonth() + 1 + '').padStart(2,'0')
  const day = (date.getDate() + '').padStart(2,'0')
  // const hh = (date.getHours() + '').padStart(2,'0')
  // const mm = (date.getMinutes() + '').padStart(2,'0')
  // const ss = (date.getSeconds() + '').padStart(2,'0')
  return `${year}-${month}-${day}`
  // return `${year}-${month}-${day} ${hh}:${mm}:${ss}
}

export function simpNum(num,numlength = 6) {
  let numStr = num+''
  if(numStr.length < numlength) {
    return num;
  }else if (numStr.length > numlength-1) {
    return parseInt(num / 10000) + '万';
  }
}

export function simString(str,strlength = 7){
  try{
    return str.substring(0,strlength-1) + '...'
  }catch{}
}

export function conName(ar){
  let arr=[]
  for(let item in ar ){
    arr.push(ar[item].name)
  }
  return arr.join('/')
}

export function addZero(num){
  if(num<10)
    return "0" + num;
  return num;
}

export function parsePlayTime(dt){
  const time = parseInt(dt/1000)
  var min = addZero(parseInt(time/60))
  var sec = addZero(parseInt(time - 60*min))
  return min + ':' + sec
}
